using System;
using Mbs.ComponentModel.Container.Metadata;

namespace Mbs.ComponentModel.Container.Listner
{
    [Serializable]
    public class KernelListnerAdapter : Listner<LifestyleStage>, IKernelListner
    {
        public KernelListnerAdapter(LifestyleStage stage) : base(LifestyleStage.None) { }

        public IKernel Kernel { get; private set; }

        void IKernelListner.Init(IKernel kernel)
        {
            Kernel = kernel;
            if (kernel != null)
                Init();
        }

        protected virtual void Init() { }

        public virtual void OnPreCreate(IComponentInfo info)
        {
        }

        public virtual void OnCreated(IComponentInfo info, object instance)
        {
        }

        public virtual void OnPreDestroy(IComponentInfo info, object instance)
        {
        }

        public virtual void OnDestroyed(IComponentInfo info, object instance)
        {
        }
    }
}
